﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Note.aspx.cs" Inherits="hcms.Admin.NoteList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>记事</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
	<link href="/Admin/Styles/rightframe.css" rel="stylesheet" type="text/css" />
	<script src="/Scripts/jquery.min.161.js" type="text/javascript"></script>
	<script src="/Scripts/comm.js" type="text/javascript"></script>
	<script src="/Admin/js/admin.js" type="text/javascript"></script>
	<style type="text/css">
		body{ padding-top:0px; padding-right:0px; margin:0px; }
		.leftbar
		{
			position: fixed;
			left:0px;
			top:0px;
			width:200px;
			bottom:0px;
			overflow:auto;
			padding:0px 10px 0px 10px;
			border-right:dotted 1px #888888;
			background-color:#f4f4ee;
		}
		
		.rightlist
		{
			margin-left:211px;
			margin-right:0px;
			width:auto;
			padding:0px;
			border-top:solid 8px #f4f4ee;
		}
		
		.div1{ margin-left:0px; margin-right:9px; }
		.div1 input, .div1 textarea{ width:100%; }
		
		#idtaskstate,#idsubmitstate{ color:#888; }
	</style>
	<script type="text/javascript">
		/*<%--function ondelete() {
			if (getcheckedstrid() == false)
				return;

			if (confirm('确定删除？')) {
				$("#cmd").val("delete");
				form1.submit();
			}
		}

		function onitemlist() {
			$("#cmd").val("itemlist");
			form1.submit();
		}--%>
*/
		function on_search() {		/*<%-- 用onsearch在Chrome中没反应，可能是Chrome的内部关键字 --%>*/
			$("#cmd").val("search");
			form1.submit();
		}

		function on_add()
		{
			try {
				$("#idsubmitstate").html("......");
				$("#idsubmit").attr("disabled", true);

				//$("#idcategory").verifyLength(0, 4000);
				$("#idtitle").verifyLength(2, 4000);
				$("#idcontent").verifyLength(0, 4000);

				if( $("#hidnoteid").val() )
					$("#cmd").val("update");
				else
					$("#cmd").val("add");
				form1.submit();
			}
			catch (err) {
				alert(err.message);
				//submitting = false;
				$("#idsubmit").attr("disabled", false);
			}
		}

		function on_select(obj, noteID)
		{
			$(".list tr").removeClass( "listselected" );
			$(obj).addClass("listselected");

			$("#hidnoteid").val(noteID);
			$("#idtitle").val($(obj).children('td').eq(1).html());	// 列号从0开始，第一列是标题
			$("#idcontent").val($(obj).children('td').eq(2).html());	// 列号从0开始，第二列是标题
			$("#idsubmit").val("修改");
			$("#idsubmitstate").html("");
		}

		$("#pager").ready(function () {
			$("#idsubmit").attr("disabled", false);

			HPages({ ctrlid: "#pager", page: $("#hidpage").val(), pages: $("#hidpages").val(),
				gopage: function (pa) {
					$("#hidpage").val(pa);
					$("#cmd").val("page");
					form1.submit();
				}
			});
		});
	</script>
</head>
<body>
    <form id="form1" runat="server">
	<input type="hidden" id="cmd" runat="server" />
	<input type="hidden" id="hidpage" runat="server" />
	<input type="hidden" id="hidpages" runat="server" />
	<input type="hidden" id="hidnoteid" runat="server" />

	<div class="leftbar">
	<h2 style="border-bottom:solid 1px #888888;">记事</h2>
	<div class="div1">
		<%--类型：<br />
		<input id="idcategory" type="text" runat="server" /><br /><br />--%>
		标题：<br />
		<input title="2-4000字符" id="idtitle" type="text" runat="server" /><br /><br />
		内容：<br />
		<textarea title="允许空，最多4000字符" cols="80" rows="10" runat="server" id="idcontent"></textarea><br /><br />
	</div>
	<input id="idsubmit" type="button" onclick="on_add()" disabled="disabled" value="添加" />&nbsp;&nbsp;
	<span id="idsubmitstate" runat="server"></span>

<br /><br /><br />
	<h2 style="border-bottom:solid 1px #888888;">搜索</h2>
	<div class="div1">
		<input id="idsearch" type="text" runat="server" /><br /><br />
	</div>
		<input type="button" onclick="on_search()" value="搜索" />
	</div>
	<div class="rightlist">
		<table class="list" cellpadding="0" cellspacing="0">
			<tr>
			<th class="center">序号</th>
			<th>标题</th>
			<th>内容</th>
			<th>日期</th>
			<th>用户</th>
			<th>IP</th>
			</tr>
			<% foreach (System.Data.DataRow row in rows)
		 { %>
			<tr onclick="on_select(this, '<%=row["noteID"]%>')">
			<td class="center"><%=row["n"]%></td>
			<td><%=row["noteTitle"]%></td>
			<td><%=row["noteContent"]%></td>
			<td><%=row["noteDate"]%></td>
			<td><%=row["userName"]%></td>
			<td><%=row["noteIP"]%></td>
			</tr>
			<%
		 } %>
		</table>
		<div id="pager"></div>
	</div>
	</form>
</body>
</html>
